using System;
using System.Collections.Generic;
using System.Text;
using System.Data ;
using System.Data .OleDb ;
using DTO;

namespace DAO
{
    public class ChiTietTraSachDAO
    {
        public List<ChiTietTraSachDTO> _laydscttrasach_DAO()
        {
            List<ChiTietTraSachDTO> list = new List<ChiTietTraSachDTO>();
            string sql = "select * from ChiTietTraSach";
            DataTable dt = DataProvider.ExcuteQuery(sql);
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dr =  dt.Rows [i];
                    int maphieutrasach = int.Parse(dr["MaPhieuTraSach"].ToString ());
                    int masach = int.Parse(dr["MaSach"].ToString());
                    DateTime  ngaytra = DateTime.Parse(dr["NgayTra"].ToString());
                    ChiTietTraSachDTO ctts = new ChiTietTraSachDTO();
                    ctts.Maphieutrasach = maphieutrasach;
                    ctts.Masach = masach;
                    ctts.Ngaytra = ngaytra;
                    list.Add(ctts );
                }
            }
            return list;
        }
    }
}
